package com.project.bohang.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bohang.entity.Visit;
import com.project.bohang.mapper.VisitMapper;
import com.project.bohang.pojo.dto.VisitDto;
import com.project.bohang.pojo.vo.VisitVo;
import com.project.bohang.service.VisitService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author bohang
 * @since 2022-03-26
 */
@Service
public class VisitServiceImpl extends ServiceImpl<VisitMapper, Visit> implements VisitService {

    @Autowired
    private VisitMapper visitMapper;

    @Override
    public IPage selectList(VisitDto dto) {
        IPage<VisitVo> page = new Page<>(dto.getPageIndex(), dto.getPageSize());
        List<VisitVo> list = visitMapper.visitList(page,dto);
        page.setRecords(list);
        return page;

    }
}
